var c1, c2, c3,c11,c12,c21,c22,c31,c32,c41,c42;

function chartResize() {
    c1.resize();
    c2.resize();
    c3.resize();
    c11.resize();
    c12.resize();
    c21.resize();
    c22.resize();
    c31.resize();
    c32.resize();
    // c41.resize();
    // c42.resize();
}
$(function () {
    loadChart();

    chartResize();

    bindFootButton();
    bindChartTable();
    bindybType();
    bindrq();
    loadCartTable();
});
function loadChart() {
//p1
    var option1 = {
        title: {
            text: '慢病病种目录用药情况',
            left: 'center'
        },

        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },

        visualMap: {
            show: false,
            min: 80,
            max: 600,
            inRange: {
                colorLightness: [0, 1]
            }
        },
        series: [
            {
                name: '慢病病种目录用药情况',
                type: 'pie',
                data: [
                    {value: 455, name: '符合病种目录'},
                    {value: 50, name: '不符合病种目录'}
                ].sort(function (a, b) {
                    return a.value - b.value;
                })
            }
        ]
    }
    var option2 = {
        title: {
            text: '慢病超量用药情况',
            left: 'center'
        },

        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        series: [
            {
                name: '慢病超量用药情况',
                type: 'pie',
                data: [
                    {value: 25, name: '超剂量'},
                    {value: 20, name: '超金额'},
                    {value: 18, name: '超频次'},
                    {value: 37, name: '非超量'}
                ].sort(function (a, b) {
                    return a.value - b.value;
                })
            }
        ]
    };

    var option3 = {
        title: {
            text: '慢病病种目录用药情况',
            left: 'center'
        },

        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        series: [
            {
                name: '慢病临不符合临床指标用药情况',
                type: 'pie',
                data: [
                    {value: 25, name: '不符合检验指标'},
                    {value: 20, name: '不符合检查指标'},
                    {value: 13, name: '不符合病情描述'},
                    {value: 42, name: '符合'}
                ].sort(function (a, b) {
                    return a.value - b.value;
                })
            }
        ]
    };


    var dom = document.getElementById("container");
    c1 = echarts.init(dom);
    c1.setOption(option1, true);

    var dom1 = document.getElementById("container1");
    c2 = echarts.init(dom1);
    c2.setOption(option2, true);

    var dom2 = document.getElementById("container2");
    c3 = echarts.init(dom2);
    c3.setOption(option3, true);

//p2
    var option11 = {
        title: {
            text: '慢病病种目录用药情况',
            left: 'center'
        },

        xAxis: {
            type: 'category',
            data: ['2018-02-01', '2018-02-02', '2018-02-03', '2018-02-04', '2018-02-05', '2018-02-06', '2018-02-07', '2018-02-08'
                , '2018-02-09', '2018-02-10', '2018-02-11', '2018-02-12', '2018-02-13'
                , '2018-02-15', '2018-02-15', '2018-02-16', '2018-02-17', '2018-02-18']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {

                type: 'line',
                data: [
                    25,28,50,30,50,
                    15,12,15,14,18,
                    58,14,42,80,57,
                    20,10,14
                ]
            }
        ]
    };
    var dom11 = document.getElementById("container11");
    c11 = echarts.init(dom11);
    c11.setOption(option11, true);

    var option12 = {
        title: {
            text: '慢病病种人次、处方数、处方金额分析',
            left: 'center'
        },

        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        series: [
            {
                name: '慢病病种人次占比分析',
                type: 'pie',
                data: [
                    {value: 40, name: '心脏病'},
                    {value: 20, name: '高血压'},
                    {value: 12, name: '肾病'}
                ].sort(function (a, b) {
                    return a.value - b.value;
                })
            }
        ]
    };
    var dom12 = document.getElementById("container12");
    c12 = echarts.init(dom12);
    c12.setOption(option12, true);

    //p3
    var option21 = {
        title: {
            text: '慢病病种符合情况分析',
            left: 'center'
        },

        xAxis: {
            type: 'category',
            data: ['2018-02-01', '2018-02-02', '2018-02-03', '2018-02-04', '2018-02-05', '2018-02-06', '2018-02-07', '2018-02-08'
                , '2018-02-09', '2018-02-10', '2018-02-11', '2018-02-12', '2018-02-13'
                , '2018-02-15', '2018-02-15', '2018-02-16', '2018-02-17', '2018-02-18']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                smooth: true,
                type: 'line',
                data: [
                    92,85,94,85,95,
                    96,95,75,85,95,
                    94,93,91,65,95,
                    95,92,91
                ]
            }
        ]
    };
    var dom21 = document.getElementById("container21");
    c21 = echarts.init(dom21);
    c21.setOption(option21, true);

    var option22 = {
        title: {
            text: '慢病病种药品不符合品种分析',
            left: 'center'
        },

        xAxis : [
            {
                type : 'category',
                data : ['醒脑静', '白蛋白', '银杏叶片'],
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series: [
            {
                name: '慢病病种人次占比分析',
                type: 'bar',
                data: [
                    92,85,94
                ]
            }
        ]
    };
    var dom22 = document.getElementById("container22");
    c22 = echarts.init(dom22);
    c22.setOption(option22, true);

    //p4
    var option31 = {
        title: {
            text: '慢病病种符合情况分析',
            left: 'center'
        },

        xAxis: {
            type: 'category',
            data: ['2018-02-01', '2018-02-02', '2018-02-03', '2018-02-04', '2018-02-05', '2018-02-06', '2018-02-07', '2018-02-08'
                , '2018-02-09', '2018-02-10', '2018-02-11', '2018-02-12', '2018-02-13'
                , '2018-02-15', '2018-02-15', '2018-02-16', '2018-02-17', '2018-02-18']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                smooth: true,
                type: 'line',
                data: [
                    92,85,94,85,95,
                    96,95,75,85,95,
                    94,93,91,65,95,
                    95,92,91
                ]
            }
        ]
    };
    var dom31 = document.getElementById("container31");
    c31 = echarts.init(dom31);
    c31.setOption(option31, true);

    var option32 = {
        title: {
            text: '慢病病种药品不符合品种分析',
            left: 'center'
        },

        xAxis : [
            {
                type : 'category',
                data : ['醒脑静', '白蛋白', '银杏叶片'],
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series: [
            {
                name: '慢病病种人次占比分析',
                type: 'bar',
                data: [
                    92,85,94
                ]
            }
        ]
    };
    var dom32 = document.getElementById("container32");
    c32 = echarts.init(dom32);
    c32.setOption(option32, true);
}